/**
 * 
 */
package metalink;

/**
 * @author Reaper
 *
 */
import java.sql.ResultSet;

import com.opensymphony.xwork2.ActionSupport;

import model.ForgotPasswordMo;
import myutil.Connect;
import vo.LoginInfoVo;

public class CheckSecurityQuestion extends ActionSupport {
	String login_id, site;
	String security_question_answer = "";
	long number;
	public String execute() {

		ForgotPasswordMo mo = new ForgotPasswordMo();
		LoginInfoVo vo = new LoginInfoVo();
		vo.setLogin_id(login_id);
		vo.setSecurity_question_answer(security_question_answer);
		/*try {
			if (mo.checkSecurityAnswer(vo, site)) {
				number = (long) Math.floor(Math.random() * 9000000000L) + 1000000000L;
				checkrandom();
				SendMail1 s=new SendMail1();
				s.to=login_id;
				s.message="<a href=\"http://192.16.11.114:8080/wildlife/confirmation.action?site="+site+"cid="+number+"\">Click Here </a> to reset your password";
				s.main();
				return SUCCESS;
			} else {
				addActionError("Incorrect security answer");
				return ERROR;
			}
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return ERROR;
		} */
		return SUCCESS;
	}
	public void checkrandom() throws Exception {
		Connect c=new Connect();
		ResultSet rs=c.getResult("select * from login_info where cid="+number+"");
		if(rs.next()){
			number = (long) Math.floor(Math.random() * 9000000000L) + 1000000000L;
			checkrandom();
		}
		else{
			return ;
		}
	}

	public String getLogin_id() {
		return login_id;
	}

	public void setLogin_id(String login_id) {
		this.login_id = login_id;
	}

	public String getSite() {
		return site;
	}

	public void setSite(String site) {
		this.site = site;
	}

	public String getSecurity_question_answer() {
		return security_question_answer;
	}

	public void setSecurity_question_answer(String security_question_answer) {
		this.security_question_answer = security_question_answer;
	}

}
